#!/usr/bin/env bash
. ./scripts/devcontainer/_assert-in-container "$0" "$@"

set -euo pipefail

# Manually deploy a single service to dark. Lighter weight version of gke-deploy
# aimed to be used by a human to deploy a subset of services that they're watching go
# out

# LIGHTTODO

# services=( "$@" )
# manifest="manual-deploy-manifest"
# CHANGE_CAUSE="manual deploy ; orig-time: $(date); git-commit: $(git rev-parse --short HEAD)"

# echo -e "\n\nservices: ${services[*]}"

# echo -e "\n\nauthorizing"
# ./scripts/production/gcp-authorize-kubectl
# gcloud auth configure-docker --quiet

# echo -e "\n\nvalidation"

# set -x
# ./scripts/deployment/shipit validate "${services[*]}"

# echo -e "\n\nbuilding containers"
# ./scripts/deployment/shipit containers build --save-manifest=$manifest "${services[*]}"

# echo -e "\n\npushing containers"
# ./scripts/deployment/shipit containers push "${services[*]}"

# for s in "${services[@]}"; do
#   echo -e "\n\napplying manual settings for $s"
#   ./scripts/deployment/shipit manual apply "$s" --dry-run=server
#   ./scripts/deployment/shipit manual apply "$s"
# done

# echo -e "\n\ndeploying release"
# ./scripts/deployment/shipit release push --manifest=$manifest --arg CHANGE_CAUSE="${CHANGE_CAUSE}" "${services[*]}" --dry-run=client
# ./scripts/deployment/shipit release push --manifest=$manifest --arg CHANGE_CAUSE="${CHANGE_CAUSE}" "${services[*]}" --dry-run=server
# ./scripts/deployment/shipit release push --manifest=$manifest --arg CHANGE_CAUSE="${CHANGE_CAUSE}" "${services[*]}"

# echo -e "\n\nnotify telemetry"
# ./scripts/deployment/_notify-deployment-rollbar "${CHANGE_CAUSE}"
# ./scripts/deployment/_notify-deployment-honeycomb "${CHANGE_CAUSE}"
